package local.app.servers;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import local.app.authentiction.AuthenticationLDAP;
import local.app.authentiction.AuthenticationRSA;

public class OtuServer extends StandardServer implements AuthenticationRSA {
    private final String userName = AuthenticationLDAP.userName;
    private final String password = AuthenticationLDAP.password;

    public OtuServer(String nameServer, String ipAddress) throws JSchException {
        super(nameServer, ipAddress);
    }

    @Override
    public Session setConfigAndReturnSession() throws JSchException {
        Session session = new JSch().getSession(userName, getIpAddress(), getPort());
        session.setPassword(password);
        session.setConfig("cipher.s2c", "aes128-cbc");
        session.setConfig("StrictHostKeyChecking", "no");
        session.setConfig("KexAlgorithms", "+diffie-hellman-group14-sha256");
        return session;
    }

}
